package exilim.exf1.cspacker.util;

import java.io.File;

import junit.framework.Assert;

import org.junit.Test;

import exilim.exf1.cspacker.util.FileUtil;

/**
 * 
 * @author Janos
 * @version 14.08.2010 | 18:08:13
 * 
 */
public class FileUtilTest {

	@Test
	public void testGetName() throws Exception {

		String result;
		File file;

		result = FileUtil.getInstance().getName(null);
		Assert.assertNull(result);

		file = new File("");
		result = FileUtil.getInstance().getName(file);
		Assert.assertEquals("", result);

		file = new File("name");
		result = FileUtil.getInstance().getName(file);
		Assert.assertEquals("name", result);

		file = new File("name.ext");
		result = FileUtil.getInstance().getName(file);
		Assert.assertEquals("name", result);

		file = new File(".ext");
		result = FileUtil.getInstance().getName(file);
		Assert.assertEquals("", result);

		file = new File("name.ext1.ext2");
		result = FileUtil.getInstance().getName(file);
		Assert.assertEquals("name.ext1", result);
	}

}
